package com.example.hewei.smarttransport.Activity;

import android.app.Activity;
import android.app.Application;
import android.app.Fragment;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v7.app.AppCompatActivity;
import android.view.KeyEvent;
import android.view.Window;

import com.example.hewei.smarttransport.AppClient;

/**
 * Created by 何伟 on 2017/3/7.
 */

public class BaseActivity extends AppCompatActivity {

    protected AppClient mApp;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
//        requestWindowFeature(Window.FEATURE_NO_TITLE);
        final Application application = getApplication();
        mApp = (AppClient) getApplication();
        mApp.setActivity(this);
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        // 添加响应返回事件
        if (keyCode == KeyEvent.KEYCODE_BACK) {
            finish();
            return true;
        }
        return super.onKeyDown(keyCode, event);
    }
}
